#ifndef __ARCH_INTERRUPTS_H__
#define __ARCH_INTERRUPTS_H__

#define IPI_CPU_MSG (0) /* 用SGI 0号中断来做cpu间通信 */

#define TIMER_IRQ_ID (27)
#define IRQ_NUM (1024)
#define IRQ_MAX_PRIO (0)

void arch_irq_enable(unsigned id);
void arch_irq_disable(unsigned id);
void arch_irq_set_prio(unsigned id, unsigned prio);
void arch_irq_send_ipi(uint64_t target_cpu, uint64_t ipi_id);
void arch_interrupts_init(void);

static inline void arch_local_irq_disable(void)
{
    asm volatile ("" ::: "memory");
    asm volatile ("cpsid    i");
    asm volatile("isb\n\t" ::: "memory");
}

static inline void arch_local_irq_enable(void)
{
    asm volatile ("" ::: "memory");
    asm volatile ("cpsie    i");
    asm volatile("isb\n\t" ::: "memory");
}

#endif /* __ARCH_INTERRUPTS_H__ */
